package com.action;

import java.util.List;

import com.dto.UserProfileDTO;
import com.opensymphony.xwork2.ActionSupport;
import com.service.UserProfileService;

public class UserProfileListAction extends ActionSupport  
{
	private List list;
	private String operation;
	private String[] check;
	
	public List getList() {
		return list;
	}
	public void setList(List list) {
		this.list = list;
	}
	public String getOperation() {
		return operation;
	}
	public void setOperation(String operation) {
		this.operation = operation;
	}
	public String[] getCheck() {
		return check;
	}
	public void setCheck(String[] check) {
		this.check = check;
	}
	
	@Override
	public String execute() throws Exception 
	{
		UserProfileDTO dto = new UserProfileDTO();
		UserProfileService service = new UserProfileService();
		list = service.getList();
		if("delete".equalsIgnoreCase(operation))
		{
			for(int i=0; i<check.length; i++)
			{
				
				dto.setPanNo(check[i]);
				service.delete(dto);
				list = service.getList();
			}
			list = service.getList();
			return "delete";
		}
		return SUCCESS;
	}
}
